﻿#ifndef SCREENWIDGET_H
#define SCREENWIDGET_H

#include <QWidget>
#include <QMenu>
#include <QPixmap>
#include <QApplication>
#include <QPainter>
#include <QMutex>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QTimer>
#include <QMouseEvent>
#include <QContextMenuEvent>
#include <QEvent>
#include <QDateTime>
#include <QStringList>
#include <QScopedPointer>
#include <QDoubleValidator>
#include "Screen.h"
#define STRDATETIME qPrintable (QDateTime::currentDateTime().toString("yyyy-MM-dd-HH-mm-ss"))

QT_BEGIN_NAMESPACE
namespace Ui { class ScreenWidget; }
QT_END_NAMESPACE

class ScreenWidget : public QWidget
{
    Q_OBJECT

public:
    static ScreenWidget *Instance();
    ScreenWidget(QWidget *parent = nullptr);
    ~ScreenWidget();

private:
    static QScopedPointer<ScreenWidget> self;
    QMenu *m_pMenu;            //右键菜单对象
    Screen *screen;         //截屏对象
    QPixmap *fullScreen;    //保存全屏图像
    QPixmap *bgScreen;      //模糊背景图
    QPoint movPos;          //坐标

protected:
    void contextMenuEvent(QContextMenuEvent *);
    void mousePressEvent(QMouseEvent *);
    void mouseMoveEvent(QMouseEvent *);
    void mouseReleaseEvent(QMouseEvent *);
    void paintEvent(QPaintEvent *);
    void showEvent(QShowEvent *);

private slots:
    void saveScreen();
    void saveFullScreen();
    void saveScreenOther();
    void saveFullOther();
    void Start();

private:
    Ui::ScreenWidget *ui;
};
#endif // SCREENWIDGET_H
